import { axios } from "apis";
import { API } from "types";
import { AppMeta } from "types/module/common";
import { AdminApi } from "./typing";

export const getGithubIssueItem = (
  params: AdminApi.IGetGithubIssueItemType,
): Promise<AdminApi.GithubIssueItem[]> => {
  console.log("getGithubIssueItem params: ", params);
  const ps = params;
  ps["notoken"] = "x";
  ps["noagent"] = "x";
  console.log("getGithubIssueItem ps: ", ps);
  return axios.request({
    method: "GET",
    url: "https://proapi.azurewebsites.net/github/issues",
    params: ps,
    // transformRequest: [
    //   (data, headers) => {
    //     console.log("data :", data);
    //     console.log("headers :", headers);
    //     delete headers.common["App-User-Agent"];
    //     return data;
    //   },
    // ],
  });
};

export const getVersion = (): Promise<API.ApiResponse<AppMeta>> => {
  return axios.request({
    method: "GET",
    url: "/rass/version",
    // params: {
    //   notoken: "x",
    // },
  });
};
